package com.gtjy.webserver4j;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.Socket;

public class ConnectionHandler implements Runnable{

	private Socket client;
	
	public ConnectionHandler(Socket client) {
		this.client = client;
	}

	public void run() {

		PrintWriter pw = null;
		BufferedReader br = null;
		try {
			br = new BufferedReader(new InputStreamReader (client.getInputStream ()));
			pw = new PrintWriter (client.getOutputStream (), true);
			String message = null;
			while((message = br.readLine()) != null){
				System.out.println(message);
			}
		} catch (IOException e) {
			e.printStackTrace();
		}finally{
			
		}
	}

	public Socket getClient() {
		return client;
	}
}
